local Lua__Invisible = fk.CreateSkill({
    name = "Lua__Invisible",
    tags = { Skill.Permanent }, 
  })
  
  
  Fk:loadTranslationTable{
    ["Lua__Invisible"] = "Invisible",
    [":Lua__Invisible"] = "持恒技，共鸣技，其他角色技能发动时，若你的技能中没有与之相同技能标签的技能，则你可以取消该技能的发动。",
  }
  
  
  local function getSkillTags(skill)
    local tags = {}
    if skill:hasTag(Skill.NotFrequent) then table.insert(tags, "默认值") end
    if skill:hasTag(Skill.Lord) then table.insert(tags, "主公技") end
    if skill:hasTag(Skill.Compulsory) then table.insert(tags, "锁定技") end
    if skill:hasTag(Skill.Limited) then table.insert(tags, "限定技") end
    if skill:hasTag(Skill.Wake) then table.insert(tags, "觉醒技") end
    if skill:hasTag(Skill.Switch) then table.insert(tags, "转换技") end
    if skill:hasTag(Skill.Quest) then table.insert(tags, "使命技") end
    if skill:hasTag(Skill.Permanent) then table.insert(tags, "持恒技") end
    if skill:hasTag(Skill.MainPlace) then table.insert(tags, "主将技") end
    if skill:hasTag(Skill.DeputyPlace) then table.insert(tags, "副将技") end
    if skill:hasTag(Skill.Hidden) then table.insert(tags, "隐匿技") end
    if skill:hasTag(Skill.AttachedKingdom) then table.insert(tags, "势力技") end
    if skill:hasTag(Skill.Charge) then table.insert(tags, "蓄力技") end
    if skill:hasTag(Skill.Family) then table.insert(tags, "宗族技") end
    if skill:hasTag(Skill.Combo) then table.insert(tags, "连招技") end
    if skill:hasTag(Skill.Rhyme) then table.insert(tags, "韵律技") end
    if skill:hasTag(Skill.Force) then table.insert(tags, "奋武技") end
    if skill:hasTag(Skill.Spirited) then table.insert(tags, "昂扬技") end
    return tags
  end
  
  
  local function haveCommonTags(skill1, skill2)
    local tags1 = getSkillTags(skill1)
    local tags2 = getSkillTags(skill2)
    if #tags1 ~= #tags2 then
      return false
    end
    table.sort(tags1)
    table.sort(tags2)
    for i = 1, #tags1 do
      if tags1[i] ~= tags2[i] then
        return false
      end
    end
    return #tags1 > 0  
  end
  
  
  local function playerHasSimilarTagSkill(player, targetSkill)
    for _, skill in ipairs(player.player_skills) do
      if skill.visible and 
         not skill.name:startsWith("#") and 
         not skill.name:endsWith("&") and 
         not skill:isEquipmentSkill(player) and
         skill.name ~= "Lua__Invisible" then
        if haveCommonTags(skill, targetSkill) then
          return true
        end
      end
    end
    return false
  end
  
  
  Lua__Invisible:addEffect(fk.SkillEffect, {
    global = true,  
    anim_type = "control",
    priority = 15,  
    can_trigger = function(self, event, target, player, data)
      if not player:hasSkill(self.name) or 
         not (player.general == "Lua__diend" or player.deputyGeneral == "Lua__diend") or
         target == player or
         not data.skill then 
        return false 
      end
      local skill = data.skill
      if skill.name:startsWith("#") then
        return false
      end
      local desc = Fk:translate(":" .. skill.name)
      if not desc or desc == "" then
        return false
      end
      if playerHasSimilarTagSkill(player, data.skill) then
        return false
      end
      return true
    end,
    on_cost = function(self, event, target, player, data)
      local room = player.room
      local skillName = data.skill.name
      local translatedName = Fk:translate(skillName)
      local promptStr = "是否取消技能【" .. translatedName .. "】的发动？"
      return room:askToSkillInvoke(player, { 
        skill_name = self.name,
        prompt = promptStr,
      })
    end,
    on_use = function(self, event, target, player, data)
      local room = player.room
      local e = room.logic:getCurrentEvent():findParent(GameEvent.SkillEffect)
      if e then
        e:shutdown()
      end
    end,
  })
  
  
  
  return Lua__Invisible